package com.qf.stubs;

import com.qf.pojo.Order;
import com.qf.service.OrderService;
import org.springframework.stereotype.Component;

import java.util.List;

//@Component
public class OrderServiceStub implements OrderService {

    private OrderService orderService;

    //这里通过构造方法传递进来的对象就是通过@Reference这个注解注入到Spring容器的对象
    public OrderServiceStub(OrderService orderService){
        this.orderService = orderService;
    }

    @Override
    public List<Order> findByUid(Integer uid) throws InterruptedException {

        if (uid > 100){
            throw new RuntimeException("该用户id不在数据库范围22222...");
        }

        //发起远程访问
        return orderService.findByUid(uid);
    }
}
